#include "stdio.h"
#include "string.h"
#include "stdlib.h"

struct Cat {
    char name[10];
    char sex[10];
    int age;
};

//堆区分配
int main() {
    struct Cat *cat = malloc(sizeof(cat));
    strcpy(cat->name, "Tom");
    cat->age = 2;
    printf("cat->name = %s, cat->age = %d\n", cat->name, cat->age);

    //释放内存
    free(cat);
    cat = NULL;
    return 0;
}